function intToBytes(value) {
  var result = new Uint8Array(4);
  result[0] = (value >> 24) & 0xff;
  result[1] = (value >> 16) & 0xff;
  result[2] = (value >> 8) & 0xff;
  result[3] = value & 0xff;
  return result;
}

function bytesToInt(dataArray) {
  var result = 0;
  result =
    ((dataArray[0] & 0xff) << 24) |
    ((dataArray[1] & 0xff) << 16) |
    ((dataArray[2] & 0xff) << 8) |
    (dataArray[3] & 0xff);
  return result;
}

export { intToBytes, bytesToInt };
